[IA64] Fix ptc.ga emulation
authorAlex Williamson <alex.williamson@hp.com>
Fri, 13 Apr 2007 14:33:21 +0000 (08:33 -0600)
committerAlex Williamson <alex.williamson@hp.com>
Fri, 13 Apr 2007 14:33:21 +0000 (08:33 -0600)
ptc.ga infrequently clobbers the region register 0.

When vcpu1 purges TLBs of vcpu2 and ptc_ga_remote_func() is called
locally not via IPI (i.e. vcpu1 shares the same pcpu with vcpu2),
in ptc_ga_remote_func(),

  save vrr[0] of vcpu2
  ... => switch to vcpu2 and set a new value of vrr[0]
  restore vrr[0] of vcpu2 // the new value is lost

Windows will crash due to this issue.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
xen/arch/ia64/vmx/vmmu.c

index 3901fbae785f11890a86e173a75090c951b7d067..bf7f8f4c31829abf59d7bab7e61a63c85fd45a96 100644 (file)
@@ -34,6 +34,7 @@
 #include <asm/vcpu.h>
 #include <xen/irq.h>
 #include <xen/errno.h>
+#include <xen/sched-if.h>
 
 /*
  * Get the machine page frame number in 16KB unit
@@ -613,8 +614,14 @@ again: /* Try again if VCPU has migrated.  */
         } else if (v == vcpu) {
             vmx_vcpu_ptc_l(v, va, ps);
         } else {
-            ptc_ga_remote_func(&args);
-            if (proc != v->processor)
+            vcpu_schedule_lock_irq(v);
+            proc = v->processor;
+            if (proc == vcpu->processor)
+                ptc_ga_remote_func(&args);
+            else
+                proc = INVALID_PROCESSOR;
+            vcpu_schedule_unlock_irq(v);
+            if (proc == INVALID_PROCESSOR)
                 goto again;
         }
     }